<template>
	<view class="cars-info">
		<view class="list">
			<view
				v-for="(item, index) in list"
				:key="item.id"
			>
				<u-gap height="20rpx" bgColor="#F7F7F7" v-if="index !== 0"></u-gap>
			
				<view class="item">
					<view class="flex-between">
						<view class="flex-align">
							<view style="margin-right: 23rpx;">{{ item.name }}</view>
							<view style="margin-right: 23rpx;" v-if="item.present">
								<u-tag text="在场" borderColor="rgba(0,0,0,0)" bgColor="rgba(47, 117, 250, 0.3)" color="#2F75FA" size="mini"></u-tag>
							</view>
							<u-tag v-if="item.default" text="默认" borderColor="rgba(0,0,0,0)" bgColor="rgba(47, 117, 250, 0.3)" color="#2F75FA" size="mini"></u-tag>
						</view>
						
						<view style="color: #BEBEBE; font-size: 28rpx;">解除绑定</view>
					</view>
					
					<view class="license-plate" :class="{ 'new-energy': item.newEnergy }">
						{{ item.licensePlate.slice(0, 2) }}·{{ item.licensePlate.slice(2) }}
					</view>
				</view>
			</view>
		</view>
		
		<view class="bottom-add-btn">
			<u-button text="添加车辆" shape="circle" @click="add" color="linear-gradient(0deg, rgb(47, 117, 250) 0%, rgb(82, 142, 255) 100%)"></u-button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				{
					id: 1,
					name: '我的车牌一',
					licensePlate: '苏FU72P99',
					present: true,
					default: true,
					newEnergy: true
				},
				{
					id: 2,
					name: '我的车牌二',
					licensePlate: '苏FW23P9'
				}
			]
		}
	},
	methods: {
		add() {
			uni.navigateTo({
				url: '/page_venues/pages/cars-info/add/add'
			});
		}
	}
}
</script>

<style lang="scss" scoped>
.cars-info {
	min-height: 100vh;
	padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
	
	.list {
		.item {
			padding: 30rpx 30rpx 50rpx;
		}
		
		.license-plate {
			margin-top: 37rpx;
			color: #FFFFFF;
			font-size: 64rpx;
			border-radius: 16rpx;
			height: 127rpx;
			line-height: 127rpx;
			text-align: center;
			letter-spacing: 20rpx;
			position: relative;
			background-color: #1C2496;
			
			&.new-energy {
				background-color: #3ACC4E;
			}
				
			&::before {
				content: '';
				position: absolute;
				left: 9rpx;
				right: 9rpx;
				top: 9rpx;
				bottom: 9rpx;
				border-radius: 8rpx;
				border: 1px solid #fff;
			}
		}
	}
}   
</style>
